#!/usr/bin/env python
#Boa:PyApp:main

import consultasBD
import utiles

modules ={}

def main():
    f=open("c:\\erpsussan.doc\\rebotes_20120817.txt","r")
    aux = f.read()
    f.close()
    lista = aux.split("\n")
    emails = []
    for i,item in enumerate(lista):
        aux = item.split()
        aux = aux[4]
        aux = aux.split("'")
        aux = aux[1]
        emails.append(aux)
    i = 1
    f=open("c:\\erpsussan.doc\\rebotesEmail.sql","w")
    for email in emails:
        sql = "SELECT idcliente,nombre FROM cliente WHERE email='"+email+"' "
        resultado = consultasBD.ordenCrudaDict(sql)
        for item in resultado:
            idcliente = item["idcliente"]
            nombre = item["nombre"]
        sql = "UPDATE cliente SET listanegra='1' WHERE email='"+email+"'; "
        f.write(sql+"\n")
        i+= 1
    f.close()
    
if __name__ == '__main__':
    main()
